package gxb.test11_1;

public class Test01 {
    public static void main(String[] args) {
        Cylinder cylinder1 = new Cylinder(1, 2, 3, 4);
        Cylinder cylinder2 = new Cylinder(5, 6, 7, 8);

        System.out.println("圆柱体 1 - 轴心坐标: (" + cylinder1.getX() + ", " + cylinder1.getY() + ")");
        System.out.println("圆柱体 1 - 半径: " + cylinder1.getR());
        System.out.println("圆柱体 1 - 高: " + cylinder1.getH());
        System.out.println("圆柱体 1 - 体积: " + cylinder1.calculateCircleVolume());

        System.out.println("圆柱体 2 - 轴心坐标: (" + cylinder2.getX() + ", " + cylinder2.getY() + ")");
        System.out.println("圆柱体 2 - 半径: " + cylinder2.getR());
        System.out.println("圆柱体 2 - 高: " + cylinder2.getH());
        System.out.println("圆柱体 2 - 体积: " + cylinder2.calculateCircleVolume());
    }
}
class Point{
    protected int x;
    protected int y;

    public Point() {
        x = 0;
        y = 0;
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
}
class Circle extends Point{
    protected int r;
    public Circle() {
        super();
        r = 0;
    }

    public Circle(int x, int y, int r) {
        super(x, y);
        this.r= r;
    }

    public double getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }
    public double calculateCircleArea() {
        return Math.PI * r * r;
    }
}
class Cylinder extends Circle{
    protected int h;

    public Cylinder() {
        super();
        h = 0;
    }

    public Cylinder(int x, int y, int r, int h) {
        super(x, y, r);
        this.h = h;
    }

    public double getH() {
        return h;
    }

    public void setH(int h) {
        this.h = h;
    }
    public double calculateCircleVolume() {
        return calculateCircleArea() * h;
    }
}